import 'package:doctor_prescribe_lib/doctor_prescribe_lib.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(TipWrapper(MyApp()));
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: '开处方',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: '开处方Example'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    super.initState();
    DoctorPrescribeLib.init();
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      DoctorPrescribeLib.initWithContext(context);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: Container(
          child: Column(
            children: [
              // RaisedButton(
              //   onPressed: () {
              //     DoctorPrescribeLib.showAddressPicker(context);
              //   },
              //   child: Text("地址选择"),
              // ),
              // RaisedButton(
              //   onPressed: () {
              //     DoctorPrescribeLib.doRegEvent(context);
              //   },
              //   child: Text("eventBus.reg"),
              // ),
              // RaisedButton(
              //   onPressed: () {
              //     DoctorPrescribeLib.postTest(context);
              //   },
              //   child: Text("eventBus.post"),
              // ),
              // RaisedButton(
              //   onPressed: () {
              //     DoctorPrescribeLib().showGenderPicker(context);
              //   },
              //   child: Text("性别选择"),
              // ),
              // RaisedButton(
              //   onPressed: () {
              //     DoctorPrescribeLib().getSicknessGroup(context);
              //   },
              //   child: Text("病史字典一级"),
              // ),
              // RaisedButton(
              //   onPressed: () {
              //     DoctorPrescribeLib().getSicknessInfo(context);
              //   },
              //   child: Text("病史字典"),
              // ),
              RaisedButton(
                onPressed: () {
                  DoctorPrescribeLib().showPrescribeDialog(context);
                },
                child: Text("开处方弹窗"),
              ),

              RaisedButton(
                onPressed: () {
                  DoctorPrescribeLib().jump2Login(context);
                },
                child: Text("去登录"),
              ),
              RaisedButton(
                onPressed: () {
                  DoctorPrescribeLib().jump2rpOrderPage(context);
                },
                child: Text("处方订单页"),
              )
            ],
          ),
        ));
  }
}
